package com.lennon.oauth.message;

public enum ResultMessage {

	SUCCESS(1, "success"),
	ERROR_CLIENT_ID(0, " error clientId "),
	ERROR_REDIRECT_URI(0, " error redirect_uri "),
	ERROR_CODE(0, " error code "),
	ERROR_GRANT_TYPE(0, " error grant_type"),
	;
	
	
	private String value;
	private int code;
	private ResultMessage(int code, String value) {
		this.code = code;
		this.value = value;
	}
	
	public String getValue() {
		return value;
	}
	
	public int getCode() {
		return this.code;
	}
	
	public ResultObject getResultObject() {
		ResultObject resultObject = new ResultObject();
		resultObject.setCode(this.code);
		resultObject.setMessage(this.getValue());
		return resultObject;
	}
	
	public <T> ResultObject getResultObject(T object) {
		ResultObject resultObject = new ResultObject();
		resultObject.setCode(this.code);
		resultObject.setMessage(this.getValue());
		resultObject.setResult(object);
		return resultObject;
	}
}
